# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-golang-x-sys
pkgver=0.0.20230208
_commit=4fee21c923398823434653737e3d413027fe4cdd
pkgrel=1
pkgdesc='Go packages for low-level interaction with the operating system'
arch=('any')
url="https://github.com/golang/sys"
license=('BSD')
depends=('go')
makedepends=('git')
source=("git+https://github.com/golang/sys.git#commit=$_commit")
sha512sums=('SKIP')

check() {
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/golang.org/x
  cp -a "$srcdir"/sys "$srcdir"/build/src/golang.org/x/sys
  cd "$srcdir"/build/src/golang.org/x/sys
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/golang.org/x
  cp -a "$srcdir"/sys "$pkgdir"/usr/share/gocode/src/golang.org/x/sys
  rm -r "$pkgdir"/usr/share/gocode/src/golang.org/x/sys/.git

  install -Dm644 sys/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
